package router

import (
	"gforum/controller"
	"gforum/middlewares"
)

// @Title user_info_router.go
// @Describe 获取，修改用户信息相关的路由

func setUpUserInfoRouter() {
	users := api.Group("/users")

	me := users.Group("/me").Use(middlewares.AuthRequired())
	// /api/users/me 需要鉴权
	{
		me.POST("/checkin", controller.CheckIn)
		me.GET("/", controller.GetMe)
		me.PUT("/info", controller.UpdateInfo)
		me.PUT("/avatar", controller.UpdateInfo)
	}

	byID := users.Group("/:id")
	// /api/users/:id
	{
		byID.GET("/info", controller.GetUserInfoByID)
		byID.GET("/level", controller.GetUserLevelByID)
		byID.GET("/posts", controller.GetUserPostsByID)
		byID.GET("/comments", controller.GetUserCommentsByID)
	}
}
